package com.zipking.cloud.springbootmybatis.callback;

import com.zipking.cloud.springbootmybatis.test.Student;

public class DataProcessor<T, R> {
    public R processData(T data, DataTransformer<T, R> transformer) {
        return transformer.transform(data);
    }

  /*  public static void main(String[] args) {
        // 简单示例1
        DataProcessor dataProcessor=new DataProcessor();
        Integer length = dataProcessor.processData("Hello", String::length);
        System.out.println(length); // 输出 5

        // 示例2：从person转换为student
        Person person = new Person();
        person.setName("zhang san");
        person.setAge(18);
        Student student = dataProcessor.processData(person, DataProcessor::convertToStudent);
        System.out.println(student);
    }

    private static Student convertToStudent(Person person) {
        Student student = new Student();
        student.setName(person.getName());
        student.setAge(person.getAge());
        return student;
    }*/
}